Day 4: loop structure (while, do... While, ),... While1. Loop Structure (while, do... While,)
1.1. What is a loop structure
In daily life, there will be a lot of things that need to be done repeatedly, such as four seasons of every year, 7 days of
Different types of loops
JavaScript supports different types of loops:For-loop code block a certain number of timesFor/in-Looping through the properties of an objectWhile-loops the specified code block when the specified condition is
1. Loop Structure (while, do... While,)
1.1. What is a loop structure
In daily life, there will be a lot of things that need to be done repeatedly, such as four seasons of every year, 7 days of every week, 3 meals a day, and 50 copies of each
In front of you to explain the PHP loop statement in the while statement loop, in fact, while the statement has another form of expression, which is what we are going to explain to you today,
"Do...while" loop statement。
Do...while The concept of
ForeachPhp Tutorial 4 (not php 3) includes the foreach structure, which is similar to perl and other languages. This is just a simple way to traverse arrays. Foreach can only be used for arrays. An error occurs when you try to use it for another
In js, the loop statements while and do while are also one of our commonly used loop statements. Next I will introduce you to the usage of the while and do-while loops, and hope to help you.
While Loop
The while statement is similar to the if
A while loop in PHP that iterates through the number of code block attempts, or loops through code blocks when the specified condition is true.
-------------------------------------------------------------
When we write code, we often need a block
While loop
A while statement, similar to an if statement, has conditions to control the execution of a statement (or statement block), and its language structure is essentially the same:while (conditions) {statements;}
A while statement differs
In the for loop described earlier, you must first create an element list to determine the number of cycles. However, consider the following example: If you enter "quit", the program will exit, otherwise, convert the characters entered by the user
Java looping structure-for, while and Do...whileThe sequential structure of a program statement can only be executed once. If you want the same operation to execute multiple times, you need to use the loop structure.There are three main loop
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.